package cn.com.bluemoon.daps.system.service.impl;

import cn.com.bluemoon.daps.system.client.DapDataSecurityModuleFacade;
import cn.com.bluemoon.daps.system.service.BizLineDeletePredicate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 元数据模块中关联业务线的删除前判断
 *
 * @author Jarod.Kong
 */
//@Service
@Slf4j
public class MetadataModuleBizLineDeletePredicate implements BizLineDeletePredicate {

    @Resource
    DapDataSecurityModuleFacade dapDataSecurityModuleFacade;

    @Override
    public Result<Integer> predicate(Integer bizLineId) {
        DapDataSecurityModuleFacade.BizLineMetadataRel res = dapDataSecurityModuleFacade.relMetaDataTableOnDeleteBizLine(bizLineId);
        return Result.<Integer>builder().canDelete(res.isCanDelete())
                .key(bizLineId).message(res.getWarnMsg()).build();
    }
}
